﻿using RaSuperGrid.SuperGrid.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RaSuperGrid.SuperGrid.ViewModel
{
    class RequestReasonTypeViewModel
    {
        private RequestReasonTypeViewModel(RequestReasonType type)
        {
            this.Type = (int) type;

            this.DisplayText = RequestReasonTypeResources.ResourceManager.GetString(type.ToString());
        }

        private RequestReasonTypeViewModel(string displayText)
        {
            this.Type = ++typeCount;

            this.DisplayText = displayText;
        }

        public int Type { get; private set; }

        public string DisplayText { get; private set; }

        private static int typeCount = (int) RequestReasonType.Upgrade;

        private static RequestReasonTypeViewModel[] _types = 
        { 
            new RequestReasonTypeViewModel(RequestReasonType.Project),
            new RequestReasonTypeViewModel(RequestReasonType.Department),
            new RequestReasonTypeViewModel(RequestReasonType.Upgrade)
        };

        public static IList<RequestReasonTypeViewModel> Types { get { return _types; } }

        public static void AddNew(string displayText)
        {
            Types.Add(new RequestReasonTypeViewModel(displayText));
        }
    }
}
